<?php
namespace app\index\controller;
use app\index\controller\Base;
use think\Db;

// 栏目列表页
class Cate extends Base
{
    public function index()
    {
        $cateid = input('cateid');
        //查询当前栏目名称
        $cates  = Db::name('cate')->find($cateid);
        $this->assign('cates',$cates);

        //查询当前栏目下的文章
        $articles = Db::name('article')
            ->where(array('cateid'=>$cateid))
            ->order('id desc')
            ->paginate(3);
        $this->assign('articles',$articles);

        return $this->fetch();
    }
}
